<%@page pageEncoding = "utf-8" contentType = "text/html;charset=utf-8"%>

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<p>
  <a href="chiefui?_action=dumb&_allRequests=true">Журнал заявок</a>
</p>


<c:if test="${sessionScope._sideBarListType == 'displayRequestsList'}">

<p>
  <a href="chiefui?_action=displayMainReport" title="Просмотреть отчет">Отчет</a>
</p>

<h2>Заявки</h2>

<p>        
  <a href = "chiefui?_action=requestAddForm" title="Добавить заявку">Новая заявка</a>
  <a href = "chiefui?_action=displayRequestSearchForm" title="Найти заявку">Поиск заявок</a>
</p>

<!-- <a href="leadexecutorui?_action=displaySearchRequestForm">Найти заявки</a>  -->
<table width="100%" cellpadding="10" cellspacing="10" style="font-size: 10px;">
<c:forEach var = "request" items = "${requestsList}">
  <tr class="marker" style="border-bottom: 1px #f1f1f1 solid;">
    <td><img src = "images/priority_item${request.priority}.gif"></td>
    <td>${request.id}</td>
    <td ${request.statusId == 6 ? 'style="text-decoration: line-through;"' : ''}>
      <c:out value="${request.name}"/>
    </td>    
    <td><fmt:formatDate value="${request.registrationDate}" pattern="dd.MM.yyyy HH:mm"/></td>        
    <td>
      <a href = "chiefui?_action=requestDetails&request_id=${request.id}">
        Детали
      </a>
    </td>
  </tr>     
</c:forEach>

<c:if test="${fn:length(requestsList) == 0}">
  <tr><td align="center">Заявок нет</td></tr>
</c:if>

</table>

<p>
<ul class = "navbarpaging">
  <c:forEach var = "pagingLink" items = "${sidebarpaging}">
    <c:choose>
      <c:when test='${pagingLink.address == ""}'>
        <li><span class="currentpage">${pagingLink.text}</span></li>
      </c:when>
      <c:otherwise>
        <li><a href="${pagingLink.address}">${pagingLink.text}</a></li>
      </c:otherwise>     
    </c:choose>       
  </c:forEach>
</ul>
</p>

</c:if>
<!-- end requests list -->


<c:if test="${sessionScope._sideBarListType == 'displayTasksList'}">

<h2>Задачи</h2>
<!--  <a href="leadexecutorui?_action=displaySearchTaskForm">Найти задачи</a> -->
<table width="100%" cellpadding="10" cellspacing="10" style="font-size: 10px;">
  <c:forEach var = "task" items = "${tasksList}">           
    <tr style="border-bottom: 1px #f1f1f1 solid;">
      <td><img src = "images/priority_item${task.priority}.gif"></td>
      <td>${task.id}</td>
      <td><c:out value="${task.name}"/></td>
      <td><fmt:formatDate value="${task.startDate}" pattern="dd.MM.yyyy"/></td>      
      <td>                 
      <a href = "${sessionScope.alias}?_action=taskDetails&task_id=${task.id}">
        Детали
      </a>
      </td>
               
    </tr>
  </c:forEach>

  <c:if test="${fn:length(tasksList) == 0}">
  <tr><td align="center">Задач нет</td></tr>
  </c:if>
  
</table>

</c:if>